Micron Document




Python syntax and semantics
part 16/45 · 74.8 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
There are also multi-line strings, which begin and end with a series of three single or double quotes and function like here documents in Perl and Ruby.

A simple example with variable interpolation (using the format method) is:

print('''Dear {recipient},
I wish you to leave Sunnydale and never return.
Not Quite Love,
{sender}
'''.format(sender="Buffy the Vampire Slayer", recipient="Spike"))

Raw strings

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────